How to Optimize Loops

    • Remove floating point operations.
    • Fold constants together.
    • Try not to divide.
    • Move a pointer rather than recomputing indices.